<template>
	<view class="match-review-container">
		<!-- 加载状态 -->
		<view v-if="loading" class="loading-container">
			<uni-load-more status="loading" :content-text="loadingText"></uni-load-more>
		</view>
		
		<!-- 层级导航面包屑 -->
		<view v-if="!loading && currentLevel > 0" class="breadcrumb">
			<view class="breadcrumb-item" @click="backToLevel(0)">
				<text class="breadcrumb-text">系列赛管理</text>
			</view>
			<uni-icons v-if="currentLevel > 0" type="right" size="14" color="#999"></uni-icons>
			<view v-if="currentLevel > 0" class="breadcrumb-item" :class="{ active: currentLevel === 1, clickable: currentLevel > 1 }" @click="handleBreadcrumbClick(1)">
				<text class="breadcrumb-text">{{ currentSeries ? currentSeries.title : '日程管理' }}</text>
			</view>
			<uni-icons v-if="currentLevel > 1" type="right" size="14" color="#999"></uni-icons>
			<view v-if="currentLevel > 1" class="breadcrumb-item active">
				<text class="breadcrumb-text">{{ currentSession ? formatSessionTitle(currentSession) : '申请审核' }}</text>
			</view>
		</view>

		<!-- 第零级：系列赛列表 -->
		<view v-if="currentLevel === 0" class="series-list">
			<!-- 系列赛筛选区域 -->
			<view class="filter-section">
				<view class="filter-tabs">
					<view 
						v-for="(filter, key) in seriesFilters" 
						:key="key"
						class="filter-tab" 
						:class="{ active: activeSeriesFilter === key }"
						@click="changeSeriesFilter(key)"
					>
						<text class="filter-tab-text">{{ filter.label }}</text>
					</view>
				</view>
			</view>
		
			<!-- 系列赛列表 -->
			<view v-if="filteredSeriesList.length === 0" class="empty-container">
				<uni-icons type="info-filled" size="60" color="#ddd"></uni-icons>
				<text class="empty-text">暂无比赛系列</text>
			</view>
			
			<view v-for="(series, index) in filteredSeriesList" :key="series._id" class="series-card" :class="seriesStatusClasses[series._id] || 'status-normal'">
				<!-- 卡片头部区域 -->
				<view class="card-header">
					<view class="title-section">
						<view class="title-row">
							<uni-icons type="trophy" size="18" color="#1BAE76"></uni-icons>
							<text class="series-title">{{ series.title }}</text>
							<!-- 状态标记 -->
							<view v-if="computeSeriesStatus(series) === 'new_applications'" class="status-badge new-applications">
								<text class="badge-text">新申请</text>
							</view>
							<view v-if="computeSeriesStatus(series) === 'completed'" class="status-badge completed">
								<text class="badge-text">已完成</text>
							</view>
						</view>
						<view class="meta-row">
							<view class="meta-item">
								<uni-icons type="calendar" size="14" color="#999"></uni-icons>
								<text class="meta-text">{{ formatDateRange(series.start_date, series.end_date) }}</text>
							</view>
							<view class="meta-item" v-if="series.location">
								<uni-icons type="location" size="14" color="#999"></uni-icons>
								<text class="meta-text">{{ series.location }}</text>
							</view>
						</view>
					</view>
									<!-- 状态指示器 -->
				<view class="status-indicator" :class="seriesStatusClasses[series._id] || 'status-normal'">
					<view class="status-dot"></view>
				</view>
				</view>
				
				<!-- 统计数据区域 -->
				<view class="stats-section">
					<view class="stat-item">
						<view class="stat-content">
							<text class="stat-number">{{ series.total_matches || 0 }}</text>
							<text class="stat-label">总场次</text>
						</view>
					</view>
					<view class="stat-divider"></view>
					<view class="stat-item" :class="{ highlight: (series.pending_applications || 0) > 0 }">
						<view class="stat-content">
							<text class="stat-number">{{ series.pending_applications || 0 }}</text>
							<text class="stat-label">待审核</text>
						</view>
					</view>
					<view class="stat-divider"></view>
					<view class="stat-item">
						<view class="stat-content">
							<text class="stat-number">{{ series.confirmed_applications || 0 }}</text>
							<text class="stat-label">已确认</text>
						</view>
					</view>
				</view>
				
				<!-- 操作按钮 -->
				<view class="card-footer">
					<button 
						class="action-btn" 
						@click="enterSeriesSchedule(series)"
						:class="{ urgent: (series.pending_applications || 0) > 0 }"
					>
						<uni-icons v-if="(series.pending_applications || 0) > 0" type="notification" size="18" color="#fff"></uni-icons>
						<uni-icons v-else type="eye" size="18" color="#fff"></uni-icons>
						<text class="btn-text">{{ (series.pending_applications || 0) > 0 ? '待审核申请' : '查看日程' }}</text>
					</button>
				</view>
			</view>
		</view>

		<!-- 第一级：日程赛程列表 -->
		<view v-if="currentLevel === 1" class="schedule-list">
			<!-- 筛选区域 -->
			<view class="filter-section">
				<view class="filter-tabs">
					<view 
						v-for="(filter, key) in statusFilters" 
						:key="key"
						class="filter-tab" 
						:class="{ active: activeStatusFilter === key }"
						@click="changeStatusFilter(key)"
					>
						<text class="filter-tab-text">{{ filter.label }}</text>
					</view>
				</view>
				
				<!-- 选派表操作入口 -->
				<view v-if="dayList && dayList.length > 0" class="selection-table-entry">
					<!-- 生成选派表按钮 -->
					<button 
						class="selection-table-btn generate-btn" 
						@click="generateSelectionTable"
						:disabled="loading"
					>
						<uni-icons type="plus-filled" size="18" color="#fff"></uni-icons>
						<text class="btn-text">生成选派表</text>
					</button>
					
					<!-- 查看历史选派表按钮 -->
					<button 
						class="selection-table-btn view-btn" 
						@click="viewSelectionTable"
						:disabled="loading"
					>
						<uni-icons type="eye-filled" size="18" color="#fff"></uni-icons>
						<text class="btn-text">查看选派表</text>
					</button>
				</view>
			</view>
		
			<!-- 日程列表 -->
			<view v-if="filteredDayList.length === 0" class="empty-container">
				<uni-icons type="info-filled" size="60" color="#ddd"></uni-icons>
				<text class="empty-text">暂无需要审核的比赛时段</text>
			</view>
			
			<view v-for="(day, index) in filteredDayList" :key="day.date" class="schedule-day" :class="{ 'day-completed': isDayAllSelectionCompleted(day) }">
							<view class="day-header">
				<uni-icons type="calendar" size="18" color="#fff"></uni-icons>
				<text class="day-title">{{ formatDayTitle(day.date) }}</text>
				<view v-if="isDayAllSelectionCompleted(day)" class="completion-badge">
					<text class="completion-text">已完成选派</text>
				</view>
			</view>
			
				<!-- 比赛时段列表 -->
				<view v-for="(session, sIndex) in day.sessions" :key="sIndex" class="session-card">
					<!-- 比赛头部：时间和状态 -->
					<view class="match-header">
						<view class="time-info">
							<uni-icons type="clock" size="16" color="#007aff"></uni-icons>
							<text class="session-time">{{ formatTimeRange(session.start_time, session.end_time) }}</text>
						</view>
					<view class="status-indicator" :class="sessionStatusClasses[day.date + '_' + session.start_time + '_' + session.end_time] || 'status-normal'">
						<view class="status-dot"></view>
					</view>
					</view>
					
					<!-- 队伍对阵信息 -->
					<view class="match-teams">
						<view class="team home-team">
							<text class="team-name">{{ session.home_team || '主队' }}</text>
						</view>
						<view class="vs-divider">
							<text class="vs-text">VS</text>
						</view>
						<view class="team away-team">
							<text class="team-name">{{ session.away_team || '客队' }}</text>
						</view>
					</view>
					
					<!-- 统计数据 -->
					<view class="match-stats">
						<view class="stat-item">
							<text class="stat-number">{{ session.total_applications || 0 }}</text>
							<text class="stat-label">总报名</text>
						</view>
						<view class="stat-divider"></view>
						<view class="stat-item" :class="{ highlight: (session.pending_applications || 0) > 0 }">
							<text class="stat-number">{{ session.pending_applications || 0 }}</text>
							<text class="stat-label">待审核</text>
						</view>
						<view class="stat-divider"></view>
						<view class="stat-item">
							<text class="stat-number">{{ session.selected_applications || 0 }}</text>
							<text class="stat-label">已选派</text>
						</view>
						<view class="stat-divider"></view>
						<view class="stat-item">
							<text class="stat-number">{{ session.confirmed_applications || 0 }}</text>
							<text class="stat-label">已确认</text>
						</view>
					</view>
					
					<!-- 岗位需求 -->
					<view v-if="session.positions && Object.keys(session.positions).length > 0" class="position-requirements">
						<view class="requirements-header">
							<uni-icons type="person" size="16" color="#8e8e93"></uni-icons>
							<text class="requirements-title">岗位需求</text>
						</view>
						<view class="requirements-list">
							<view v-for="(count, position) in session.positions" :key="position" class="requirement-item">
								<view class="position-icon" :class="positionIconClasses[day.date + '_' + session.start_time + '_' + session.end_time + '_' + position] || 'icon-default'">
									<text class="icon-text">{{ getPositionIcon(position) }}</text>
								</view>
								<text class="position-info">{{ getPositionName(position) }} {{ count }}人</text>
							</view>
						</view>
					</view>
					
					<!-- 操作按钮 -->
					<view class="match-footer">
						<button 
							class="action-btn" 
							@click="enterReviewMode(day, session)"
							:class="{ urgent: (session.pending_applications || 0) > 0 }"
						>
							<uni-icons v-if="(session.pending_applications || 0) > 0" type="notification" size="18" color="#fff"></uni-icons>
							<uni-icons v-else type="list" size="18" color="#fff"></uni-icons>
							<text class="btn-text">{{ (session.pending_applications || 0) > 0 ? '待审核 ' + session.pending_applications + ' 人' : '查看申请' }}</text>
						</button>
					</view>
				</view>
			</view>
		</view>
					
		<!-- 第二级：申请审核 -->
		<view v-if="currentLevel === 2" class="application-review">
			<!-- 合并的比赛信息和筛选卡片 -->
			<view class="combined-info-card">
				<!-- 比赛信息区域 -->
				<view class="match-info-section">
					<view class="match-header">
						<text class="match-title">{{ formatSessionTitle(currentSession) }}</text>
						<text class="match-time">{{ formatTimeRange(currentSession.start_time, currentSession.end_time) }}</text>
					</view>
					<view class="match-details">
						<text class="match-date">{{ formatDate(currentDay.date) }}</text>
						<text class="match-count">{{ sessionApplications.length }}人报名</text>
					</view>
				</view>
				
				<!-- 申请状态筛选 -->
				<view class="filter-section">
					<view class="filter-tabs">
						<view 
							v-for="(filter, key) in applicationFilters" 
							:key="key"
							class="filter-tab"
							:class="{ active: activeApplicationFilter === key }"
							@click="changeApplicationFilter(key)"
						>
							<text class="filter-tab-text">{{ filter.label }}</text>
							<text class="filter-count">({{ getApplicationFilterCount(key) }})</text>
						</view>
					</view>
				</view>
			</view>
						
			<!-- 岗位分组申请列表 -->
			<view class="position-groups">
				<view v-for="(position, key) in sessionPositionGroups" :key="key" class="position-group" :class="'position-' + key.replace('_', '-')">
					<view class="position-header" @click="togglePositionCollapse(key)">
						<view class="position-header-left">
							<text class="position-title">{{ getPositionName(key) }}</text>
							<text class="position-count">{{ position.applications.length }}人报名</text>
						</view>
						<view class="position-header-right">
							<text class="collapse-icon">{{ getPositionCollapseIcon(key) }}</text>
						</view>
					</view>
						
					<view class="position-content" :class="{ 'collapsed': isPositionCollapsed(key) }">
						<view v-if="position.applications.length === 0" class="empty-position">
							<text class="empty-text">暂无{{ getPositionName(key) }}报名</text>
						</view>
						
						<view 
							v-for="(application, index) in position.applications" 
							:key="application._id"
							class="application-item"
						>
							<view class="application-info">
								<!-- 用户信息区域 -->
								<view class="user-info-section">
									<view class="user-header">
										<text class="user-name">{{ getUserName(application) }}</text>
									<view class="user-identity-badge" :class="applicationIdentityClasses[application._id] || 'identity-user'">
										<text class="identity-text">{{ getUserIdentity(application) }}</text>
									</view>
										<view v-if="getUserLevel(application)" class="user-level-inline">
											<text class="level-text">{{ getUserLevel(application) }}</text>
										</view>
									</view>
									
									<view class="user-details-row">
										<text class="user-age-gender">{{ getUserAge(application) }}岁 · {{ getUserGender(application) }}</text>
									</view>
									
									<view v-if="getUserAssociation(application)" class="user-association-row">
										<text class="user-association">{{ getUserAssociation(application) }}</text>
									</view>
									
									<!-- 意向岗位信息 -->
									<view v-if="getUserPreferredPositions(application).length > 0" class="user-preferred-positions-row">
										<text class="preferred-positions-label">🎯 意向岗位：</text>
										<text class="preferred-positions-value">{{ getUserPreferredPositions(application).join('、') }}</text>
									</view>
								</view>
								
								<!-- 操作按钮区域 -->
								<view class="action-buttons">
									<!-- pending状态：显示通过选派和拒绝选派按钮 -->
									<button 
										v-if="application.status === 'pending'"
										class="action-btn approve-btn" 
										@click="reviewApplication(application, 'selected')"
										:disabled="reviewing"
									>
										通过选派
									</button>
									<button 
										v-if="application.status === 'pending'"
										class="action-btn reject-btn" 
										@click="showRejectModal(application)"
										:disabled="reviewing"
									>
										拒绝选派
									</button>
									
									<!-- selected状态：显示撤回选派按钮 -->
									<button 
										v-if="application.status === 'selected'"
										class="action-btn revoke-btn" 
										@click="revokeSelection(application)"
										:disabled="reviewing"
									>
										撤回选派
									</button>
									
									<!-- confirmed/rejected状态：显示状态标签 -->
									<view v-if="['confirmed', 'rejected'].includes(application.status)" class="status-badge" :class="'status-' + application.status">
										<text class="status-text">{{ getApplicationStatusText(application.status) }}</text>
									</view>
								</view>
							</view>
						
							<!-- 用户详细信息（可展开） -->
							<view v-if="application.showDetails" class="application-details">
								<view v-if="getCertificationDate(application)" class="detail-row">
									<text class="detail-label">认证时间：</text>
									<text class="detail-value">{{ formatCertificationDate(getCertificationDate(application)) }}</text>
								</view>
								<view v-if="application.user_info && application.user_info.experience" class="detail-row">
									<text class="detail-label">执裁记录：</text>
									<text class="detail-value">{{ application.user_info.experience }}场比赛</text>
								</view>
								<view v-if="application.conflicts && application.conflicts.length > 0" class="detail-row conflict">
									<text class="detail-label">⚠️ 报名冲突：</text>
									<text class="detail-value">与{{ application.conflicts.length }}个时段重叠</text>
								</view>
								<view class="detail-row">
									<text class="detail-label">联系方式：</text>
									<text class="detail-value">{{ getUserPhone(application) }}</text>
								</view>
							</view>
							
							<view class="toggle-details" @click="toggleApplicationDetails(application)">
								<text class="toggle-text">{{ application.showDetails ? '收起详情' : '查看详情' }}</text>
								<text class="toggle-icon">{{ application.showDetails ? '⌃' : '⌄' }}</text>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		
		<!-- 拒绝理由弹窗 -->
		<uni-popup ref="rejectPopup" type="center" :mask-click="false">
			<view class="reject-popup">
				<view class="popup-header">
					<text class="popup-title">拒绝申请</text>
				</view>
				<view class="popup-content">
					<text class="popup-label">请填写拒绝理由</text>
					<textarea 
						class="reject-reason-input" 
						v-model="rejectReason" 
						placeholder="请输入拒绝理由"
						maxlength="200"
					/>
				</view>
				<view class="popup-actions">
					<button class="popup-btn cancel-btn" @click="cancelReject">取消</button>
					<button class="popup-btn confirm-btn" @click="confirmReject">确定</button>
				</view>
			</view>
		</uni-popup>

		<!-- 轮次选派汇总表弹窗 -->
		<uni-popup ref="roundSelectionPopup" type="center" :mask-click="false" background-color="rgba(0,0,0,0.7)">
			<view class="round-selection-popup">
				<view class="popup-header">
					<text class="popup-title">本轮比赛安排表</text>
				</view>
				<view class="popup-content">
					<!-- 比赛基本信息 -->
					<view v-if="roundSelectionData" class="match-info-section">
						<view class="info-row">
							<text class="info-label">系列赛名称：</text>
							<text class="info-value">{{ roundSelectionData.series_title }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">选派时间：</text>
							<text class="info-value">{{ formatDateTime(new Date()) }}</text>
						</view>
						<view class="info-row">
							<text class="info-label">总计：</text>
							<text class="info-value">{{ roundSelectionData.total_matches }}场比赛，{{ roundSelectionData.total_selected }}人次</text>
						</view>
					</view>

					<!-- 比赛安排时间轴 -->
					<view class="match-schedule-timeline">
						<view v-if="roundSelectionData && roundSelectionData.matches" class="timeline-container">
							<view v-for="(dayGroup, dateKey) in groupedMatches" :key="dateKey" class="timeline-day">
								<!-- 日期标题 -->
								<view class="date-header">
									<text class="date-text">{{ formatTableDate(dateKey) }} 星期{{ getWeekday(dateKey) }}</text>
								</view>
								
								<!-- 该日期下的所有比赛 -->
								<view v-for="(match, index) in dayGroup" :key="index" class="time-slot-card">
									<view class="match-header">
										<text class="teams">{{ match.home_team }} vs {{ match.away_team }}</text>
										<text class="venue-info">【{{ match.venue }}】</text>
									</view>
									
									<view class="time-info">
										<text class="time-range">{{ match.time_range }}</text>
									</view>
									
									<!-- 裁判安排 -->
									<view class="referee-assignments">
										<view v-if="match.main_referee && match.main_referee !== '-'" class="referee-item">
											<text class="referee-name">{{ match.main_referee }}</text>
											<text class="referee-position">(主裁判)</text>
											<view v-if="match.main_referee_phone" class="phone-container">
												<text class="referee-phone">{{ match.main_referee_phone }}</text>
											</view>
										</view>
										<view v-if="match.assistant_referee && match.assistant_referee !== '-'" class="referee-item">
											<text class="referee-name">{{ match.assistant_referee }}</text>
											<text class="referee-position">(助理裁判)</text>
											<view v-if="match.assistant_referee_phone" class="phone-container">
												<text class="referee-phone">{{ match.assistant_referee_phone }}</text>
											</view>
										</view>
										<view v-if="match.fourth_official && match.fourth_official !== '-'" class="referee-item">
											<text class="referee-name">{{ match.fourth_official }}</text>
											<text class="referee-position">(第四官员)</text>
											<view v-if="match.fourth_official_phone" class="phone-container">
												<text class="referee-phone">{{ match.fourth_official_phone }}</text>
											</view>
										</view>
										<view v-if="match.referee_supervisor && match.referee_supervisor !== '-'" class="referee-item">
											<text class="referee-name">{{ match.referee_supervisor }}</text>
											<text class="referee-position">(裁判监督)</text>
											<view v-if="match.referee_supervisor_phone" class="phone-container">
												<text class="referee-phone">{{ match.referee_supervisor_phone }}</text>
											</view>
										</view>
										
										<!-- 等待选派提示 -->
										<view v-if="!hasAnyReferee(match)" class="waiting-assignment">
											<text class="waiting-text">等待选派...</text>
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
				<view class="popup-actions">
					<button class="popup-btn cancel-btn" @click="cancelRoundSelection">返回修改</button>
					<button class="popup-btn confirm-btn" @click="confirmRoundSelection">发送本轮选派</button>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
export default {
	data() {
		return {
			loading: true,
			reviewing: false,
			loadingText: {
				contentdown: '下拉刷新',
				contentrefresh: '正在刷新...',
				contentnomore: '没有更多数据了'
			},
			
			// 层级导航 - 修改为三级
			currentLevel: 0, // 0: 系列赛列表, 1: 日程列表, 2: 申请审核
			currentSeries: null,
			currentDay: null,
			currentSession: null,
			
			// 数据列表
			seriesList: [], // 系列赛列表
			dayList: [],
			sessionApplications: [], // 当前时段的申请列表
			
			// 系列赛状态筛选
			activeSeriesFilter: 'all',
			seriesFilters: {
				all: { label: '全部系列' },
				in_progress: { label: '进行中' },
				pending: { label: '有待审核' },
				completed: { label: '已完成' }
			},
			
			// 日程状态筛选
			activeStatusFilter: 'all',
			statusFilters: {
				all: { label: '全部时段' },
				pending: { label: '有待审核' },
				completed: { label: '审核完成' },
				urgent: { label: '紧急处理' }
			},

			// 申请状态筛选
			activeApplicationFilter: 'all',
			applicationFilters: {
				all: { label: '全部' },
				pending: { label: '待审核' },
				selected: { label: '已选派' },
				confirmed: { label: '已确认' },
				rejected: { label: '已拒绝' }
			},
			
			// 拒绝相关
			rejectReason: '',
			currentRejectItem: null,
			
			// 轮次选派汇总相关
			roundSelectionData: null,
			
			// 岗位名称映射
			positionNames: {
				main_referee: '主裁判',
				assistant_referee: '助理裁判',
				fourth_official: '第四官员',
				referee_supervisor: '裁判监督',
				match_supervisor: '比赛监督'
			},
			
			// 岗位折叠状态管理
			positionCollapsedState: {}
		}
	},
	
	computed: {
		// 筛选后的系列赛列表
		filteredSeriesList() {
			if (this.activeSeriesFilter === 'all') {
				return this.seriesList
			}
			
			return this.seriesList.filter(series => {
				switch (this.activeSeriesFilter) {
					case 'in_progress':
						return series.status === 'in_progress' || series.status === 'published'
					case 'pending':
						return (series.pending_applications || 0) > 0
					case 'completed':
						return series.status === 'completed'
					default:
						return true
				}
			})
		},
		
		// 筛选后的日程列表
		filteredDayList() {
			if (this.activeStatusFilter === 'all') {
				return this.dayList
			}
			
			return this.dayList.map(day => {
				const filteredSessions = day.sessions.filter(session => {
					switch (this.activeStatusFilter) {
						case 'pending':
							return (session.pending_applications || 0) > 0
						case 'completed':
							// 已完成：有申请且没有待审核的（即所有申请都已处理）
							return (session.pending_applications || 0) === 0 && (session.total_applications || 0) > 0
						case 'urgent':
							return (session.pending_applications || 0) > 10 // 待审核超过10人算紧急
						default:
							return true
					}
				})
				
				return {
					...day,
					sessions: filteredSessions
				}
			}).filter(day => day.sessions.length > 0)
		},

		// 当前时段按岗位分组的申请列表（支持申请状态筛选）
		sessionPositionGroups() {
			const groups = {}
			const positions = this.currentSession?.positions || {}
			
			// 初始化岗位分组
			Object.keys(positions).forEach(position => {
				groups[position] = {
					applications: []
				}
			})
			
			// 如果没有岗位信息，使用默认岗位
			if (Object.keys(groups).length === 0) {
				Object.keys(this.positionNames).forEach(position => {
					groups[position] = {
						applications: []
					}
				})
			}
			
					// 按申请状态筛选（排除已取消的申请）
		const activeApplications = this.sessionApplications.filter(app => app.status !== 'cancelled')
		const filteredApplications = this.activeApplicationFilter === 'all' 
			? activeApplications 
			: activeApplications.filter(app => app.status === this.activeApplicationFilter)
			
			// 将申请分配到对应岗位
			filteredApplications.forEach(application => {
				const position = application.position || 'main_referee'
				if (groups[position]) {
					groups[position].applications.push(application)
				}
			})
			
			return groups
		},

		// 选派进度统计
		selectionProgress() {
			if (!this.sessionApplications || !Array.isArray(this.sessionApplications)) {
				return {
					pending: 0,
					selected: 0,
					confirmed: 0,
					rejected: 0
				}
			}

			const progress = {
				pending: 0,
				selected: 0,
				confirmed: 0,
				rejected: 0
			}

			// 排除已取消的申请
			const activeApplications = this.sessionApplications.filter(app => app.status !== 'cancelled')
			activeApplications.forEach(app => {
				const status = app.status || 'pending'
				if (progress.hasOwnProperty(status)) {
					progress[status]++
				}
			})

			return progress
		},

		// 是否显示轮次选派功能（有比赛日程就显示）
		showRoundSelectionFeature() {
			return this.dayList && this.dayList.length > 0
		},

		// 本轮总时段数
		totalSessionsCount() {
			let count = 0
			this.dayList.forEach(day => {
				count += day.sessions.length
			})
			return count
		},

		// 按日期分组的比赛数据
		groupedMatches() {
			if (!this.roundSelectionData || !this.roundSelectionData.matches) {
				return {}
			}
			
			const grouped = {}
			this.roundSelectionData.matches.forEach(match => {
				const date = match.date
				if (!grouped[date]) {
					grouped[date] = []
				}
				grouped[date].push(match)
			})
			
			// 按时间排序每天的比赛
			Object.keys(grouped).forEach(date => {
				grouped[date].sort((a, b) => {
					return a.time_range.localeCompare(b.time_range)
				})
			})
			
			return grouped
		},

		// 是否显示选派表入口（简化逻辑，只要有比赛日程就显示）
		showSelectionTableEntry() {
			return this.dayList && this.dayList.length > 0
		},
		
		// 系列赛状态类计算
		seriesStatusClasses() {
			const classes = {}
			if (this.filteredSeriesList) {
				this.filteredSeriesList.forEach(series => {
					const status = this.computeSeriesStatus(series)
					let statusClass = 'status-normal'
					
					switch (status) {
						case 'new_applications':
							statusClass = 'status-new-applications'
							break
						case 'pending':
							statusClass = 'status-pending'
							break
						case 'completed':
							statusClass = 'status-completed'
							break
						case 'in_progress':
							statusClass = 'status-active'
							break
						default:
							statusClass = 'status-normal'
					}
					classes[series._id] = statusClass
				})
			}
			return classes
		},
		
		// 比赛时段状态类计算
		sessionStatusClasses() {
			const classes = {}
			if (this.filteredDayList) {
				this.filteredDayList.forEach(day => {
					day.sessions.forEach(session => {
						let statusClass = 'status-normal'
						if ((session.pending_applications || 0) > 0) {
							statusClass = 'status-pending'
						} else if ((session.confirmed_applications || 0) > 0) {
							statusClass = 'status-confirmed'
						} else if ((session.selected_applications || 0) > 0) {
							statusClass = 'status-selected'
						}
						const key = `${day.date}_${session.start_time}_${session.end_time}`
						classes[key] = statusClass
					})
				})
			}
			return classes
		},
		
		// 用户身份类计算
		applicationIdentityClasses() {
			const classes = {}
			if (this.sessionApplications) {
				this.sessionApplications.forEach(app => {
					const identity = app.user_info?.referee_identity || '普通用户'
					let identityClass = 'identity-user'
					if (identity === '裁判员') {
						identityClass = 'identity-referee'
					} else if (identity === '裁判监督') {
						identityClass = 'identity-supervisor'
					}
					classes[app._id] = identityClass
				})
			}
			return classes
		},
		
		// 岗位图标类计算
		positionIconClasses() {
			const getIconClass = (position) => {
				if (position === 'main_referee') return 'icon-main'
				if (position === 'assistant_referee') return 'icon-assistant'
				if (position === 'fourth_official') return 'icon-fourth'
				if (position === 'referee_supervisor') return 'icon-supervisor'
				return 'icon-default'
			}
			
			const classes = {}
			if (this.filteredDayList) {
				this.filteredDayList.forEach(day => {
					day.sessions.forEach(session => {
						if (session.positions) {
							Object.keys(session.positions).forEach(position => {
								const key = `${day.date}_${session.start_time}_${session.end_time}_${position}`
								classes[key] = getIconClass(position)
							})
						}
					})
				})
			}
			return classes
		}

	},
	
	onLoad() {
		this.loadSeriesList()
	},
	
	onShow() {
		this.refreshCurrentLevel()
	},
	
	onPullDownRefresh() {
		this.refreshCurrentLevel().then(() => {
			uni.stopPullDownRefresh()
		})
	},
	
	// 拦截所有返回操作，实现逐级返回
	onBackPress() {
		console.log(`返回操作被拦截，当前层级: ${this.currentLevel}`)
		
		if (this.currentLevel > 0) {
			// 如果不在第0级，则返回上一级
			const targetLevel = this.currentLevel - 1
			console.log(`执行逐级返回：${this.currentLevel} → ${targetLevel}`)
			
			// 使用 nextTick 确保DOM更新完成
			this.$nextTick(() => {
				this.backToLevel(targetLevel)
			})
			
			return true // 阻止默认返回行为
		}
		
		// 如果在第0级，则允许正常返回
		console.log('在第0级，允许正常返回到上一页面')
		return false
	},
	
	methods: {
		// 刷新当前层级数据
		async refreshCurrentLevel() {
			switch (this.currentLevel) {
				case 0:
					await this.loadSeriesList()
					break
				case 1:
					await this.loadScheduleList()
					break
				case 2:
					await this.loadSessionApplications()
					break
			}
		},
		
		// 加载系列赛列表
		async loadSeriesList() {
			this.loading = true
			try {
				// 获取用户信息
				const userInfoStr = uni.getStorageSync('userInfo')
				if (!userInfoStr) {
					uni.showToast({
						title: '请先登录',
						icon: 'none'
					})
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login'
						})
					}, 1500)
					return
				}
				
				const userInfo = JSON.parse(userInfoStr)
				const userId = userInfo._id || userInfo.userId || userInfo.id
				
				// 调用云对象获取用户发布的系列赛
				const matchObject = uniCloud.importObject('match-object')
				const result = await matchObject.getMyMatches({ 
					userId: userId
				})
				
				if (result.code === 0) {
					// 处理分页格式的数据
					const matchList = result.data?.list || []
					
					// 处理系列赛数据，统计各项指标
					this.seriesList = this.processSeriesData(matchList)
				} else {
					console.error('获取系列赛失败:', result.message)
					uni.showToast({
						title: result.message || '获取数据失败',
						icon: 'none'
					})
					this.seriesList = []
				}
				
			} catch (error) {
				console.error('加载系列赛列表失败:', error)
				uni.showToast({
					title: '网络错误',
					icon: 'none'
				})
				this.seriesList = []
			} finally {
				this.loading = false
			}
		},
		
		// 处理系列赛数据
		processSeriesData(matchList) {
			// 添加类型检查，确保传入的是数组
			if (!Array.isArray(matchList)) {
				console.error('processSeriesData 期望接收数组，但收到:', typeof matchList, matchList)
				return []
			}
			
			// 云对象已经处理好了统计数据，直接返回并应用智能排序
			const processedList = matchList.map(match => {
				return {
					...match,
					// 云对象已经包含了这些统计字段，不需要重新计算
					// total_matches, total_applications, pending_applications, confirmed_applications
				}
			})
			
			// 应用智能排序
			return this.sortSeriesList(processedList)
		},
		
		// 计算系列赛状态
		computeSeriesStatus(series) {
			// 检查是否有新申请（24小时内）
			const hasNewApplications = this.hasNewApplications(series)
			
			// 检查是否已完成
			const isCompleted = this.isSeriesCompleted(series)
			
			// 检查是否有待审核申请
			const hasPendingApplications = (series.pending_applications || 0) > 0
			
			if (hasNewApplications && hasPendingApplications) {
				return 'new_applications'
			} else if (hasPendingApplications) {
				return 'pending'
			} else if (isCompleted) {
				return 'completed'
			} else {
				return 'in_progress'
			}
		},
		
		// 判断系列赛是否已完成
		isSeriesCompleted(series) {
			// 如果状态已经是 completed，直接返回 true
			if (series.status === 'completed') {
				return true
			}
			
			// 检查是否所有申请都已处理完成（7天前的比赛且无新活动）
			const endDate = new Date(series.end_date)
			const now = new Date()
			const daysSinceEnd = (now - endDate) / (1000 * 60 * 60 * 24)
			
			// 如果比赛结束超过7天，且没有待审核申请，则认为已完成
			return daysSinceEnd > 7 && (series.pending_applications || 0) === 0
		},
		
		// 检查是否有新申请（24小时内）
		hasNewApplications(series) {
			// 检查是否有最近更新的申请
			if (!series.last_application_time) {
				return false
			}
			
			const lastApplicationTime = new Date(series.last_application_time)
			const now = new Date()
			const hoursSinceLastApplication = (now - lastApplicationTime) / (1000 * 60 * 60)
			
			return hoursSinceLastApplication <= 24
		},
		
		// 智能排序系列赛列表
		sortSeriesList(seriesList) {
			return seriesList.sort((a, b) => {
				const statusA = this.computeSeriesStatus(a)
				const statusB = this.computeSeriesStatus(b)
				
				// 排序优先级：
				// 1. 有新申请的系列赛置顶
				// 2. 有待审核的系列赛
				// 3. 进行中的系列赛
				// 4. 已完成的系列赛沉底
				
				const priorityMap = {
					'new_applications': 1,
					'pending': 2,
					'in_progress': 3,
					'completed': 4
				}
				
				const priorityA = priorityMap[statusA] || 3
				const priorityB = priorityMap[statusB] || 3
				
				// 如果优先级不同，按优先级排序
				if (priorityA !== priorityB) {
					return priorityA - priorityB
				}
				
				// 如果优先级相同，按创建时间倒序（新的在前）
				const createTimeA = new Date(a.create_time || a.createdAt || 0)
				const createTimeB = new Date(b.create_time || b.createdAt || 0)
				return createTimeB - createTimeA
			})
		},
		
		// 进入系列赛日程
		enterSeriesSchedule(series) {
			this.currentSeries = series
			this.currentLevel = 1
			this.loadScheduleList()
		},
		
		// 加载日程列表
		async loadScheduleList() {
			this.loading = true
			try {
				// 获取用户信息
				const userInfoStr = uni.getStorageSync('userInfo')
				if (!userInfoStr) {
					uni.showToast({
						title: '请先登录',
						icon: 'none'
					})
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login'
						})
					}, 1500)
					return
				}
				
				const userInfo = JSON.parse(userInfoStr)
				const userId = userInfo._id || userInfo.userId || userInfo.id
				
				// 调用云对象获取用户发布的系列赛
				const matchObject = uniCloud.importObject('match-object')
				const result = await matchObject.getMyMatches({ 
					userId: userId
				})
				
				if (result.code === 0) {
					// 处理分页格式的数据
					const matchList = result.data?.list || []
					
					// 处理数据，提取所有日程
					this.dayList = this.processScheduleData(matchList)
				} else {
					console.error('获取日程失败:', result.message)
					uni.showToast({
						title: result.message || '获取数据失败',
						icon: 'none'
					})
					this.dayList = []
				}
				
			} catch (error) {
				console.error('加载日程列表失败:', error)
				uni.showToast({
					title: '网络错误',
					icon: 'none'
				})
				this.dayList = []
			} finally {
				this.loading = false
			}
		},

		// 处理日程数据
		processScheduleData(matchList) {
			// 添加类型检查，确保传入的是数组
			if (!Array.isArray(matchList)) {
				console.error('processScheduleData 期望接收数组，但收到:', typeof matchList, matchList)
				return []
			}
			
			const allDays = []
			
			// 如果设置了当前系列赛，只处理当前系列赛的数据
			const seriesFilter = this.currentSeries ? [this.currentSeries] : matchList
			
			seriesFilter.forEach(match => {
				const schedules = match.schedules || []
				schedules.forEach(schedule => {
					const sessions = (schedule.sessions || []).map(session => {
						// 计算申请统计（排除已取消的申请）
						const allApplications = session.applications || []
						const applications = allApplications.filter(app => app.status !== 'cancelled')
						const totalApplications = applications.length
						const pendingApplications = applications.filter(app => app.status === 'pending').length
						const selectedApplications = applications.filter(app => app.status === 'selected').length
						const confirmedApplications = applications.filter(app => app.status === 'confirmed').length
						const rejectedApplications = applications.filter(app => app.status === 'rejected').length
						
						return {
							...session,
							series_title: match.title, // 使用比赛标题而不是系列赛标题
							total_applications: totalApplications,
							pending_applications: pendingApplications, // 只有真正待审核的
							selected_applications: selectedApplications, // 已选派但未确认的
							confirmed_applications: confirmedApplications, // 已确认的
							rejected_applications: rejectedApplications, // 已拒绝的
							home_team: session.home_team || '主队',
							away_team: session.away_team || '客队'
						}
					})
					
					if (sessions.length > 0) {
						allDays.push({
							date: schedule.date,
							sessions: sessions
						})
					}
				})
			})
			
			// 智能排序：已完成选派的日程移到队尾
			return this.sortScheduleDays(allDays)
		},
		
		// 判断某一天是否所有时段都已完成选派
		isDayAllSelectionCompleted(day) {
			if (!day.sessions || day.sessions.length === 0) {
				return false
			}
			
			// 检查每个时段是否都已完成选派（没有待审核的申请）
			return day.sessions.every(session => {
				const pendingApplications = session.pending_applications || 0
				return pendingApplications === 0
			})
		},
		
		// 智能排序日程列表
		sortScheduleDays(dayList) {
			return dayList.sort((a, b) => {
				const aCompleted = this.isDayAllSelectionCompleted(a)
				const bCompleted = this.isDayAllSelectionCompleted(b)
				
				// 如果选派完成状态不同，已完成的排在后面
				if (aCompleted !== bCompleted) {
					return aCompleted ? 1 : -1
				}
				
				// 如果选派完成状态相同，按日期排序
				return new Date(a.date) - new Date(b.date)
			})
		},
		
		// 进入审核模式
		enterReviewMode(day, session) {
			this.currentDay = day
			this.currentSession = session
			this.currentLevel = 2
			// 重置岗位折叠状态，默认所有岗位展开
			this.positionCollapsedState = {}
			this.loadSessionApplications()
		},

		// 加载时段申请列表
		async loadSessionApplications() {
			if (!this.currentSession) return
			
			this.loading = true
			try {
				// 获取用户信息
				const userInfoStr = uni.getStorageSync('userInfo')
				if (!userInfoStr) {
					uni.showToast({
						title: '请先登录',
						icon: 'none'
					})
					return
				}
				
				const userInfo = JSON.parse(userInfoStr)
				const userId = userInfo._id || userInfo.userId || userInfo.id
				
				// 调用云对象获取申请列表
				const matchScheduleObject = uniCloud.importObject('match-schedule-object')
				const result = await matchScheduleObject.getSlotApplications({
					userId: userId,
					sessionId: this.currentSession.session_id || this.currentSession._id
				})
				
				if (result.code === 0) {
					this.sessionApplications = (result.data || []).map(app => ({
						...app,
						showDetails: false
					}))
					
					// 加载完成后自动更新统计数据
					this.updateSessionStats()
				} else {
					console.error('获取申请列表失败:', result.message)
					uni.showToast({
						title: result.message || '获取数据失败',
						icon: 'none'
					})
					this.sessionApplications = []
				}
				
			} catch (error) {
				console.error('加载申请列表失败:', error)
				uni.showToast({
					title: '网络错误',
					icon: 'none'
				})
				this.sessionApplications = []
			} finally {
				this.loading = false
			}
		},

		// 处理面包屑导航点击
		handleBreadcrumbClick(level) {
			console.log(`面包屑导航点击: 目标层级 ${level}, 当前层级 ${this.currentLevel}`)
			if (this.currentLevel > level) {
				this.backToLevel(level)
			}
		},

		// 返回到指定层级
		backToLevel(level) {
			console.log(`返回到层级: ${level}, 当前层级: ${this.currentLevel}`)
			this.currentLevel = level
			switch (level) {
				case 0:
					this.currentSeries = null
					this.currentDay = null
					this.currentSession = null
					this.loadSeriesList()
					break
				case 1:
					this.currentDay = null
					this.currentSession = null
					this.loadScheduleList()
					break
				case 2:
					// 从第2级返回时不需要清空数据，保持当前申请数据
					this.loadSessionApplications()
					break
			}
		},
		
		// 切换系列赛筛选
		changeSeriesFilter(key) {
			this.activeSeriesFilter = key
		},
		
		// 切换状态筛选
		changeStatusFilter(key) {
			this.activeStatusFilter = key
		},

		// 切换申请筛选
		changeApplicationFilter(key) {
			this.activeApplicationFilter = key
		},

		// 获取申请筛选数量
		getApplicationFilterCount(filterKey) {
			if (!this.sessionApplications || !Array.isArray(this.sessionApplications)) {
				return 0
			}
			// 排除已取消的申请
			const activeApplications = this.sessionApplications.filter(app => app && app.status !== 'cancelled')
			if (filterKey === 'all') {
				return activeApplications.length
			}
			return activeApplications.filter(app => app.status === filterKey).length
		},

		// 获取状态文本
		getStatusText(status) {
			const statusMap = {
				'draft': '草稿',
				'published': '已发布',
				'in_progress': '进行中',
				'completed': '已完成',
				'cancelled': '已取消'
			}
			return statusMap[status] || status
		},
		
		// 获取岗位名称
		getPositionName(key) {
			return this.positionNames[key] || key
		},
		

		
		// 获取岗位图标
		getPositionIcon(position) {
			const iconMap = {
				main_referee: '主',
				assistant_referee: '助',
				fourth_official: '四',
				referee_supervisor: '监',
				match_supervisor: '督'
			}
			return iconMap[position] || '岗'
		},
		

		
		// 格式化日期范围
		formatDateRange(startDate, endDate) {
			if (!startDate || !endDate) return ''
			const start = this.formatDateOnly(startDate)
			const end = this.formatDateOnly(endDate)
			return start === end ? start : `${start} ~ ${end}`
		},
		
		// 格式化日期
		formatDateOnly(date) {
			if (!date) return ''
			const d = new Date(date)
			const month = String(d.getMonth() + 1).padStart(2, '0')
			const day = String(d.getDate()).padStart(2, '0')
			return `${month}月${day}日`
		},
		
		// 格式化日期标题
		formatDayTitle(date) {
			if (!date) return ''
			const d = new Date(date)
			const weekdays = ['日', '一', '二', '三', '四', '五', '六']
			const weekday = weekdays[d.getDay()]
			return `${this.formatDateOnly(date)} 星期${weekday}`
		},
		
		// 格式化时间范围
		formatTimeRange(startTime, endTime) {
			if (!startTime || !endTime) return ''
			return `${startTime}-${endTime}`
		},
		
		// 格式化日期时间
		formatDateTime(date) {
			if (!date) return ''
			const d = new Date(date)
			const month = String(d.getMonth() + 1).padStart(2, '0')
			const day = String(d.getDate()).padStart(2, '0')
			const hour = String(d.getHours()).padStart(2, '0')
			const minute = String(d.getMinutes()).padStart(2, '0')
			return `${month}-${day} ${hour}:${minute}`
		},
		
		// 格式化日期（新增）
		formatDate(date) {
			if (!date) return ''
			const d = new Date(date)
			const month = String(d.getMonth() + 1).padStart(2, '0')
			const day = String(d.getDate()).padStart(2, '0')
			const weekdays = ['日', '一', '二', '三', '四', '五', '六']
			const weekday = weekdays[d.getDay()]
			return `${month}月${day}日 星期${weekday}`
		},
		
		// 格式化时段标题（新增）
		formatSessionTitle(session) {
			if (!session) return ''
			if (session.home_team && session.away_team) {
				return `${session.home_team} vs ${session.away_team}`
			}
			return '比赛时段'
		},
		
		// 切换申请详情显示（新增）
		toggleApplicationDetails(application) {
			this.$set(application, 'showDetails', !application.showDetails)
		},
		
		// 获取用户姓名
		getUserName(application) {
			return application.user_info?.name || application.user_name || '匿名用户'
		},

		// 获取用户手机
		getUserPhone(application) {
			return application.user_info?.phone || application.contact_info || '未提供'
		},
		
		// 获取用户性别
		getUserGender(application) {
			return application.user_info?.gender || '未知'
		},

		// 获取用户年龄
		getUserAge(application) {
			return application.user_info?.age || '未知'
		},

		// 获取用户身份
		getUserIdentity(application) {
			return application.user_info?.referee_identity || '普通用户'
		},



		// 获取用户等级
		getUserLevel(application) {
			return application.user_info?.referee_level || ''
		},

		// 获取所属协会
		getUserAssociation(application) {
			return application.user_info?.register_organization || ''
		},

		// 获取用户意向岗位
		getUserPreferredPositions(application) {
			if (!application.preferred_positions || application.preferred_positions.length === 0) {
				return []
			}
			
			// 将意向岗位key转换为显示名称
			const positionNames = {
				main_referee: '主裁判',
				assistant_referee: '助理裁判',
				fourth_official: '第四官员',
				referee_supervisor: '裁判监督'
			}
			
			return application.preferred_positions.map(key => 
				positionNames[key] || key
			)
		},

		// 切换岗位折叠状态
		togglePositionCollapse(positionKey) {
			// 使用Vue.set来确保响应式
			this.$set(this.positionCollapsedState, positionKey, !this.positionCollapsedState[positionKey])
		},

		// 获取岗位折叠状态
		isPositionCollapsed(positionKey) {
			return this.positionCollapsedState[positionKey] || false
		},

		// 获取岗位折叠图标
		getPositionCollapseIcon(positionKey) {
			return this.isPositionCollapsed(positionKey) ? '▶' : '▼'
		},

		// 获取认证时间
		getCertificationDate(application) {
			return application.user_info?.certification_date || ''
		},

		// 格式化认证时间
		formatCertificationDate(date) {
			if (!date) return ''
			const d = new Date(date)
			const year = d.getFullYear()
			const month = String(d.getMonth() + 1).padStart(2, '0')
			const day = String(d.getDate()).padStart(2, '0')
			return `${year}-${month}-${day}`
		},

		// 获取申请状态文本（新增）
		getApplicationStatusText(status) {
			const statusMap = {
				'pending': '待审核',
				'selected': '已选派',
				'confirmed': '已确认',
				'rejected': '已拒绝'
			}
			return statusMap[status] || status
		},

		// 审核申请（新增）
		async reviewApplication(application, result) {
			if (result === 'rejected') {
				this.showRejectModal(application)
				return
			}
			
			this.reviewing = true
			try {
				// 获取用户信息
				const userInfoStr = uni.getStorageSync('userInfo')
				if (!userInfoStr) {
					uni.showToast({
						title: '请先登录',
						icon: 'none'
					})
					return
				}
				
				const userInfo = JSON.parse(userInfoStr)
				const userId = userInfo._id || userInfo.userId || userInfo.id
				
				// 调用云对象审核申请
				const matchScheduleObject = uniCloud.importObject('match-schedule-object')
				const reviewResult = await matchScheduleObject.reviewSlotApplication({
					userId: userId,
					applicationId: application._id,
					status: result,
					comment: result === 'selected' ? '初步选派' : ''
				})
				
				if (reviewResult.code === 0) {
					// 更新本地数据
					application.status = result
					application.review_time = new Date()
					application.review_note = result === 'selected' ? '初步选派' : ''
					
					// 重新加载数据以验证云端更新是否成功
					await this.loadSessionApplications()
					
					uni.showToast({
						title: reviewResult.message || (result === 'selected' ? '选派成功' : '已拒绝'),
						icon: 'success'
					})
				} else {
					uni.showToast({
						title: reviewResult.message || '操作失败',
						icon: 'none'
					})
				}
				
			} catch (error) {
				console.error('审核失败:', error)
				uni.showToast({
					title: '操作失败',
					icon: 'none'
				})
			} finally {
				this.reviewing = false
			}
		},
		
		// 撤回选派
		async revokeSelection(application) {
			console.log('撤回选派 - 申请信息:', application)
			
			// 二次确认
			const confirmResult = await new Promise((resolve) => {
				uni.showModal({
					title: '确认撤回',
					content: `确定要撤回对 ${this.getUserName(application)} 的选派吗？`,
					success: (res) => {
						resolve(res.confirm)
					}
				})
			})

			if (!confirmResult) {
				return
			}

			this.reviewing = true
			try {
				// 获取用户信息
				const userInfoStr = uni.getStorageSync('userInfo')
				if (!userInfoStr) {
					uni.showToast({
						title: '请先登录',
						icon: 'none'
					})
					return
				}
				
				const userInfo = JSON.parse(userInfoStr)
				const userId = userInfo._id || userInfo.userId || userInfo.id
				
				console.log('撤回选派 - 用户信息:', { userId, applicationId: application._id })
				
				// 调用云对象撤回选派
				const matchScheduleObject = uniCloud.importObject('match-schedule-object')
				const revokeResult = await matchScheduleObject.revokeSlotSelection({
					applicationId: application._id
				})
				
				console.log('撤回选派 - 云对象返回:', revokeResult)
				
				if (revokeResult.code === 0) {
					// 更新本地数据
					application.status = 'pending'
					application.review_time = new Date()
					application.review_note = '撤回选派'
					
					// 重新加载数据以验证云端更新是否成功
					await this.loadSessionApplications()
					
					uni.showToast({
						title: revokeResult.message || '撤回成功',
						icon: 'success'
					})
				} else {
					uni.showToast({
						title: revokeResult.message || '撤回失败',
						icon: 'none'
					})
				}
				
			} catch (error) {
				console.error('撤回选派失败:', error)
				uni.showToast({
					title: '撤回失败',
					icon: 'none'
				})
			} finally {
				this.reviewing = false
			}
		},
		
		// 显示拒绝弹窗（新增）
		showRejectModal(application) {
			this.currentRejectItem = application
			this.rejectReason = ''
			this.$refs.rejectPopup.open()
		},

		// 取消拒绝
		cancelReject() {
			this.rejectReason = ''
			this.currentRejectItem = null
			this.$refs.rejectPopup.close()
		},
		
		// 确认拒绝
		async confirmReject() {
			if (!this.currentRejectItem) return
			
			try {
				this.reviewing = true
				
				// 获取用户信息
				const userInfoStr = uni.getStorageSync('userInfo')
				if (!userInfoStr) {
					uni.showToast({
						title: '请先登录',
						icon: 'none'
					})
					return
				}
				
				const userInfo = JSON.parse(userInfoStr)
				const userId = userInfo._id || userInfo.userId || userInfo.id
				
				// 调用match-schedule-object的reviewSlotApplication方法，确保数据同步
				const matchScheduleObject = uniCloud.importObject('match-schedule-object')
				const result = await matchScheduleObject.reviewSlotApplication({
					userId: userId,
					applicationId: this.currentRejectItem._id,
					status: 'rejected',
					comment: this.rejectReason
				})
				
				if (result.code === 0) {
					// 更新本地申请状态
					this.currentRejectItem.status = 'rejected'
					this.currentRejectItem.review_time = new Date()
					this.currentRejectItem.review_note = this.rejectReason
					
					// 重新加载数据以验证云端更新是否成功
					await this.loadSessionApplications()
					
					uni.showToast({
						title: '已拒绝申请',
						icon: 'success'
					})
				} else {
					throw new Error(result.message || '操作失败')
				}
			} catch (error) {
				console.error('拒绝申请失败:', error)
				uni.showToast({
					title: error.message || '操作失败',
					icon: 'none'
				})
			} finally {
				this.reviewing = false
				this.cancelReject()
			}
		},

		// 取消轮次选派
		cancelRoundSelection() {
			this.roundSelectionData = null
			this.$refs.roundSelectionPopup.close()
		},

		// 确认轮次选派
		async confirmRoundSelection() {
			if (!this.roundSelectionData) {
				return
			}

			// 二次确认
			const confirmResult = await new Promise((resolve) => {
				uni.showModal({
					title: '确认发送',
					content: `确定要发送本轮选派吗？共${this.roundSelectionData.total_matches}场比赛，${this.roundSelectionData.total_selected}人次将被最终确认。`,
					success: (res) => {
						resolve(res.confirm)
					}
				})
			})

			if (!confirmResult) {
				return
			}

			uni.showLoading({
				title: '发送中...'
			})

			try {
				// 获取用户信息
				const userInfoStr = uni.getStorageSync('userInfo')
				if (!userInfoStr) {
					uni.showToast({
						title: '请先登录',
						icon: 'none'
					})
					return
				}
				
				const userInfo = JSON.parse(userInfoStr)
				const userId = userInfo._id || userInfo.userId || userInfo.id
				
				// 调用云对象完成轮次选派
				const matchScheduleObject = uniCloud.importObject('match-schedule-object')
				const result = await matchScheduleObject.completeRoundSelection({
					sessionIds: this.roundSelectionData.session_ids
				})
				
				if (result.code === 0) {
					uni.showToast({
						title: result.message || '本轮选派完成',
						icon: 'success'
					})
					
					// 关闭弹窗并刷新数据
					this.cancelRoundSelection()
					await this.loadScheduleList()
				} else {
					uni.showToast({
						title: result.message || '发送失败',
						icon: 'none'
					})
				}
				
			} catch (error) {
				console.error('完成轮次选派失败:', error)
				uni.showToast({
					title: '发送失败',
					icon: 'none'
				})
			} finally {
				uni.hideLoading()
			}
		},

		// 格式化表格日期
		formatTableDate(date) {
			if (!date) return ''
			const d = new Date(date)
			const month = String(d.getMonth() + 1).padStart(2, '0')
			const day = String(d.getDate()).padStart(2, '0')
			return `${month}月${day}日`
		},

		// 获取星期几
		getWeekday(date) {
			if (!date) return ''
			const d = new Date(date)
			const weekdays = ['日', '一', '二', '三', '四', '五', '六']
			return weekdays[d.getDay()]
		},



		// 格式化时间轴日期
		formatTimelineDate(date) {
			if (!date) return ''
			const d = new Date(date)
			const month = String(d.getMonth() + 1).padStart(2, '0')
			const day = String(d.getDate()).padStart(2, '0')
			const weekdays = ['日', '一', '二', '三', '四', '五', '六']
			const weekday = weekdays[d.getDay()]
			return `${month}月${day}日 星期${weekday}`
		},

		// 获取比赛状态样式类
		getMatchStatusClass(match) {
			// 检查是否有裁判安排
			if (this.hasAnyReferee(match)) {
				return 'status-assigned' // 已选派
			} else {
				return 'status-pending' // 待选派
			}
		},

		// 检查是否有任何裁判
		hasAnyReferee(match) {
			return (match.main_referee && match.main_referee !== '-') ||
				   (match.assistant_referee && match.assistant_referee !== '-') ||
				   (match.fourth_official && match.fourth_official !== '-') ||
				   (match.referee_supervisor && match.referee_supervisor !== '-')
		},
		
		// 生成选派表（完成最终选派确认）
		async generateSelectionTable() {
			uni.showLoading({
				title: '生成选派表...'
			})

			try {
				// 获取用户信息
				const userInfoStr = uni.getStorageSync('userInfo')
				if (!userInfoStr) {
					uni.showToast({
						title: '请先登录',
						icon: 'none'
					})
					return
				}
				
				const userInfo = JSON.parse(userInfoStr)
				const userId = userInfo._id || userInfo.userId || userInfo.id
				
				// 收集所有时段ID，让云对象筛选selected状态的申请
				const allSessionIds = []
				this.dayList.forEach(day => {
					day.sessions.forEach(session => {
						
						allSessionIds.push(session.session_id || session._id)
					})
				})

				if (allSessionIds.length === 0) {
					uni.showToast({
						title: '暂无比赛时段',
						icon: 'none'
					})
					return
				}
				
				// 调用云对象获取选派汇总（用于生成选派表）
				const matchScheduleObject = uniCloud.importObject('match-schedule-object')
				const result = await matchScheduleObject.getRoundSelectionSummary({
					sessionIds: allSessionIds,
					onlySelected: true // 只获取已选派但未确认的申请
				})
				
				if (result.code === 0) {
					if (!result.data || result.data.matches.length === 0) {
						uni.showModal({
							title: '提示',
							content: '没有符合条件的比赛时段。\n\n条件说明：\n1. 必须有经过初次选派的申请\n2. 不能有已完成最终选派的申请',
							showCancel: false,
							confirmText: '我知道了'
						})
						return
					}
					
					// 显示选派表预览弹窗
					this.roundSelectionData = result.data
					this.$refs.roundSelectionPopup.open()
				} else {
					// 特殊处理没有符合条件时段的情况
					if (result.message && result.message.includes('没有找到')) {
						uni.showModal({
							title: '提示',
							content: '没有符合条件的比赛时段。\n\n条件说明：\n1. 必须有经过初次选派的申请\n2. 不能有已完成最终选派的申请',
							showCancel: false,
							confirmText: '我知道了'
						})
					} else {
						uni.showToast({
							title: result.message || '生成选派表失败',
							icon: 'none'
						})
					}
				}
				
			} catch (error) {
				console.error('生成选派表失败:', error)
				uni.showToast({
					title: '生成选派表失败',
					icon: 'none'
				})
			} finally {
				uni.hideLoading()
			}
		},

		// 查看完整选派表（查看已确认的历史记录）
		async viewSelectionTable() {
			uni.showLoading({
				title: '加载中...'
			})

			try {
				// 获取用户信息
				const userInfoStr = uni.getStorageSync('userInfo')
				if (!userInfoStr) {
					uni.showToast({
						title: '请先登录',
						icon: 'none'
					})
					return
				}
				
				const userInfo = JSON.parse(userInfoStr)
				const userId = userInfo._id || userInfo.userId || userInfo.id
				
				// 收集所有时段ID，让云对象筛选confirmed状态的申请
				const allSessionIds = []
				this.dayList.forEach(day => {
					day.sessions.forEach(session => {
						allSessionIds.push(session.session_id || session._id)
					})
				})

				if (allSessionIds.length === 0) {
					uni.showToast({
						title: '暂无比赛时段',
						icon: 'none'
					})
					return
				}
				
				// 调用云对象获取选派汇总（查看已确认的记录）
				const matchScheduleObject = uniCloud.importObject('match-schedule-object')
				const result = await matchScheduleObject.getRoundSelectionSummary({
					sessionIds: allSessionIds,
					onlyConfirmed: true // 只获取已确认的申请
				})
				
				if (result.code === 0) {
					// 生成存储key
					const storageKey = 'selection_table_' + Date.now()
					
					// 存储数据到本地（即使是空数据也存储，让选派表页面处理空状态）
					uni.setStorageSync(storageKey, result.data || { matches: [] })
					
					// 跳转到选派表页面
					uni.navigateTo({
						url: `/packageMy/my/schedule-viewer?key=${storageKey}&role=admin`
					})
				} else {
					uni.showToast({
						title: result.message || '获取选派表失败',
						icon: 'none'
					})
				}
				
			} catch (error) {
				console.error('查看选派表失败:', error)
				uni.showToast({
					title: '获取选派表失败',
					icon: 'none'
				})
			} finally {
				uni.hideLoading()
			}
		},

		// 更新当前时段的统计数据
		updateSessionStats() {
			if (!this.currentSession || !this.sessionApplications) {
				console.warn('updateSessionStats: 缺少必要数据', { 
					hasCurrentSession: !!this.currentSession, 
					hasSessionApplications: !!this.sessionApplications 
				})
				return
			}
			
					// 重新计算统计数据（排除已取消的申请）
		const applications = this.sessionApplications.filter(app => app.status !== 'cancelled')
		const totalApplications = applications.length
		const pendingApplications = applications.filter(app => app.status === 'pending').length
		const selectedApplications = applications.filter(app => app.status === 'selected').length
		const confirmedApplications = applications.filter(app => app.status === 'confirmed').length
		const rejectedApplications = applications.filter(app => app.status === 'rejected').length
			
			console.log('统计数据计算结果:', {
				total: totalApplications,
				pending: pendingApplications,
				selected: selectedApplications,
				confirmed: confirmedApplications,
				rejected: rejectedApplications,
				applications: applications.map(app => ({ id: app._id, status: app.status }))
			})
			
			// 更新当前时段对象
			this.currentSession.total_applications = totalApplications
			this.currentSession.pending_applications = pendingApplications
			this.currentSession.selected_applications = selectedApplications
			this.currentSession.confirmed_applications = confirmedApplications
			this.currentSession.rejected_applications = rejectedApplications
			
			// 同时更新 dayList 中对应的时段数据
			if (this.currentDay && this.dayList.length > 0) {
				const dayIndex = this.dayList.findIndex(day => day.date === this.currentDay.date)
				if (dayIndex !== -1) {
					const sessionIndex = this.dayList[dayIndex].sessions.findIndex(session => 
						(session.session_id || session._id) === (this.currentSession.session_id || this.currentSession._id)
					)
					if (sessionIndex !== -1) {
						// 更新 dayList 中的统计数据
						Object.assign(this.dayList[dayIndex].sessions[sessionIndex], {
							total_applications: totalApplications,
							pending_applications: pendingApplications,
							selected_applications: selectedApplications,
							confirmed_applications: confirmedApplications,
							rejected_applications: rejectedApplications
						})
						
						console.log('统计数据已更新:', {
							sessionId: this.currentSession.session_id || this.currentSession._id,
							total: totalApplications,
							pending: pendingApplications,
							selected: selectedApplications,
							confirmed: confirmedApplications,
							rejected: rejectedApplications
						})
					}
				}
			}
		},
		
		// 错误处理
		handleError(message) {
			console.error('Error:', message)
			uni.showToast({
				title: message,
				icon: 'none'
			})
		}
	}
}
</script>

<style lang="scss" scoped>
.match-review-container {
	min-height: 100vh;
	background-color: #f2f2f7;
	padding: 16rpx 8rpx;
}

// 加载状态
.loading-container {
	display: flex;
	justify-content: center;
	align-items: center;
	height: 400rpx;
}

// 面包屑导航
.breadcrumb {
	display: flex;
	align-items: center;
	background-color: #fff;
	padding: 16rpx 20rpx;
	border-radius: 16rpx;
	margin: 0 8rpx 16rpx 8rpx;
	box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.06);
	border: 1rpx solid rgba(0, 0, 0, 0.04);
}

.breadcrumb-item {
	cursor: pointer;
	
	&:not(.active) {
		.breadcrumb-text {
			color: #007aff;
			
			&:hover {
				text-decoration: underline;
			}
		}
	}
	
	&.active {
		.breadcrumb-text {
			color: #1d1d1f;
			font-weight: 600;
		}
	}
	
	&.clickable {
		.breadcrumb-text {
			&:hover {
				color: #007aff;
			}
		}
	}
}

.breadcrumb-text {
	font-size: 30rpx;
	margin: 0 10rpx;
	letter-spacing: -0.3rpx;
}

// 日程列表
.schedule-list {
	.empty-container {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		height: 400rpx;
		background-color: #fff;
		border-radius: 16rpx;
		margin: 0 8rpx;
		box-shadow: 0 2rpx 20rpx rgba(0, 0, 0, 0.06);

		.empty-text {
			font-size: 32rpx;
			color: #999;
			margin-top: 20rpx;
		}
	}
}

.schedule-day {
	margin: 0 8rpx 16rpx 8rpx;
	
	&.day-completed {
		opacity: 0.75;
		
		.day-header {
			background: linear-gradient(135deg, #8E8E93 0%, #636366 100%);
			box-shadow: 0 4rpx 20rpx rgba(142, 142, 147, 0.2);
		}
	}
	
	.day-header {
		background: linear-gradient(135deg, #1BAE76 0%, #52c41a 100%);
		padding: 16rpx 20rpx;
		border-radius: 16rpx 16rpx 0 0;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12rpx;
		box-shadow: 0 4rpx 20rpx rgba(27, 174, 118, 0.2);
		
		.day-title {
			font-size: 32rpx;
			font-weight: 600;
			color: #fff;
			letter-spacing: -0.3rpx;
			flex: 1;
		}
		
		.completion-badge {
			background: rgba(255, 255, 255, 0.2);
			padding: 8rpx 16rpx;
			border-radius: 12rpx;
			border: 1rpx solid rgba(255, 255, 255, 0.3);
			backdrop-filter: blur(10rpx);
			
			.completion-text {
				font-size: 22rpx;
				color: #fff;
				font-weight: 600;
				letter-spacing: 0.5rpx;
			}
		}
	}
}

.session-card {
	background-color: #fff;
	border-radius: 0 0 16rpx 16rpx;
	margin-bottom: 16rpx;
	box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08);
	border: 1rpx solid rgba(0, 0, 0, 0.04);
	overflow: hidden;
	
	&:not(:last-child) {
		border-radius: 0;
		margin-bottom: 2rpx;
	}
	
	&:last-child {
		border-radius: 0 0 16rpx 16rpx;
		margin-bottom: 0;
	}
	
	// 比赛头部
	.match-header {
		padding: 16rpx 20rpx 12rpx 20rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-bottom: 1rpx solid #f5f5f5;
		
		.time-info {
			display: flex;
			align-items: center;
			gap: 8rpx;
			background-color: #f8f9fa;
			padding: 8rpx 12rpx;
			border-radius: 12rpx;
			border: 1rpx solid #e5e5ea;
			
			.session-time {
				font-size: 30rpx;
				color: #1d1d1f;
				font-weight: 600;
				letter-spacing: -0.3rpx;
			}
		}
		
		.status-indicator {
			.status-dot {
				width: 16rpx;
				height: 16rpx;
				border-radius: 50%;
				background-color: #d1d1d6;
			}
			
			&.status-pending .status-dot {
				background-color: #ff9500;
				box-shadow: 0 0 0 2rpx rgba(255, 149, 0, 0.2);
			}
			
			&.status-selected .status-dot {
				background-color: #007aff;
				box-shadow: 0 0 0 2rpx rgba(0, 122, 255, 0.2);
			}
			
			&.status-confirmed .status-dot {
				background-color: #30d158;
				box-shadow: 0 0 0 2rpx rgba(48, 209, 88, 0.2);
			}
		}
	}
	
	// 队伍对阵
	.match-teams {
		padding: 16rpx 20rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 20rpx;
		
		.team {
			flex: 1;
			text-align: center;
			
			.team-name {
				font-size: 36rpx;
				font-weight: 600;
				color: #1d1d1f;
				letter-spacing: -0.5rpx;
			}
		}
		
		.vs-divider {
			background: linear-gradient(135deg, #ff9500, #ff6b35);
			width: 64rpx;
			height: 64rpx;
			border-radius: 50%;
			display: flex;
			align-items: center;
			justify-content: center;
			box-shadow: 0 4rpx 12rpx rgba(255, 149, 0, 0.3);
			
			.vs-text {
				font-size: 20rpx;
				font-weight: 700;
				color: #fff;
				letter-spacing: 1rpx;
			}
		}
	}
	
	// 统计数据
	.match-stats {
		display: flex;
		align-items: center;
		padding: 12rpx 20rpx 16rpx 20rpx;
		
		.stat-item {
			flex: 1;
			text-align: center;
			
			&.highlight .stat-number {
				color: #ff9500;
			}
			
			.stat-number {
				display: block;
				font-size: 30rpx;
				font-weight: 600;
				color: #1d1d1f;
				margin-bottom: 4rpx;
				letter-spacing: -0.3rpx;
			}
			
			.stat-label {
				font-size: 24rpx;
				color: #8e8e93;
				font-weight: 400;
			}
		}
		
		.stat-divider {
			width: 1rpx;
			height: 24rpx;
			background-color: #e5e5ea;
			margin: 0 8rpx;
		}
	}
	
	// 岗位需求
	.position-requirements {
		padding: 16rpx 20rpx;
		border-top: 1rpx solid #f5f5f5;
		
		.requirements-header {
			display: flex;
			align-items: center;
			gap: 8rpx;
			margin-bottom: 12rpx;
			
			.requirements-title {
				font-size: 28rpx;
				color: #8e8e93;
				font-weight: 500;
			}
		}
		
		.requirements-list {
			display: flex;
			flex-wrap: wrap;
			gap: 12rpx;
			
			.requirement-item {
				display: flex;
				align-items: center;
				gap: 8rpx;
				padding: 8rpx 12rpx;
				background-color: #f8f9fa;
				border-radius: 16rpx;
				border: 1rpx solid #e5e5ea;
				
				.position-icon {
					width: 28rpx;
					height: 28rpx;
					border-radius: 50%;
					display: flex;
					align-items: center;
					justify-content: center;
					
					.icon-text {
						font-size: 20rpx;
						font-weight: 600;
						color: #fff;
					}
					
					&.icon-main {
						background: linear-gradient(135deg, #ff8c42, #ff6b35);
					}
					
					&.icon-assistant {
						background: linear-gradient(135deg, #5b9bd5, #4472c4);
					}
					
					&.icon-fourth {
						background: linear-gradient(135deg, #70ad47, #5b9930);
					}
					
					&.icon-supervisor {
						background: linear-gradient(135deg, #8e44ad, #9b59b6);
					}
					
					&.icon-default {
						background: linear-gradient(135deg, #8e8e93, #aeaeb2);
					}
				}
				
				.position-info {
					font-size: 26rpx;
					color: #1d1d1f;
					font-weight: 500;
					letter-spacing: -0.2rpx;
				}
			}
		}
	}
	
	// 操作按钮
	.match-footer {
		padding: 0 20rpx 16rpx 20rpx;
		
		.action-btn {
			width: 100%;
			height: 72rpx;
			border-radius: 16rpx;
			font-size: 30rpx;
			font-weight: 500;
			border: none;
			background: linear-gradient(135deg, #1BAE76 0%, #52c41a 100%);
			color: #fff;
			display: flex;
			align-items: center;
			justify-content: center;
			gap: 8rpx;
			box-shadow: 0 4rpx 16rpx rgba(27, 174, 118, 0.25);
			transition: all 0.2s ease;
			
			&.urgent {
				background: linear-gradient(135deg, #ff9500 0%, #ff6b35 100%);
				box-shadow: 0 4rpx 16rpx rgba(255, 149, 0, 0.3);
			}
			
			&:active {
				transform: scale(0.95);
				box-shadow: 0 2rpx 8rpx rgba(27, 174, 118, 0.3);
			}
			
			.btn-text {
				font-size: 30rpx;
				font-weight: 500;
				color: #fff;
				letter-spacing: -0.3rpx;
			}
		}
	}
}

// 筛选区域
.filter-section {
	background-color: #fff;
	padding: 16rpx 20rpx;
	border-radius: 16rpx;
	margin: 0 8rpx 16rpx 8rpx;
	box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.06);
	border: 1rpx solid rgba(0, 0, 0, 0.04);
}

	.filter-tabs {
		display: flex;
		gap: 8rpx;
		padding: 4rpx;
		background-color: #f2f2f7;
		border-radius: 16rpx;
		
		.filter-tab {
			flex: 1;
			text-align: center;
			padding: 16rpx 12rpx;
			border-radius: 12rpx;
			background-color: transparent;
			transition: all 0.2s ease;
			
			&.active {
				background-color: #fff;
				box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
				
				.filter-tab-text {
					color: #1d1d1f;
					font-weight: 600;
				}
			}
			
			.filter-tab-text {
				font-size: 30rpx;
				color: #8e8e93;
				font-weight: 400;
				letter-spacing: -0.3rpx;
			}
		}
	}



// 申请审核样式
.application-review {
	// 合并的信息和筛选卡片
	.combined-info-card {
		background-color: #fff;
		margin-bottom: 20rpx;
		border-radius: 16rpx;
		padding: 20rpx 16rpx; // 减少左右内边距
		box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.1);
		
		.match-info-section {
			margin-bottom: 20rpx;
			
			.match-header {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-bottom: 12rpx;
				
				.match-title {
					font-size: 28rpx;
					font-weight: bold;
					color: #333;
					flex: 1;
				}
				
				.match-time {
					font-size: 24rpx;
					color: #1BAE76;
					font-weight: 500;
					background-color: #f0f8ff;
					padding: 4rpx 12rpx;
					border-radius: 12rpx;
					border: 1rpx solid #d9d9d9;
				}
			}
			
			.match-details {
				display: flex;
				gap: 24rpx;
				
				.match-date {
					font-size: 24rpx;
					color: #666;
				}
				
				.match-count {
					font-size: 24rpx;
					color: #1BAE76;
					font-weight: 500;
				}
			}
		}
		
		.filter-section {
			border-top: 1rpx solid #f0f0f0;
			padding: 16rpx 0 0 0; // 减少顶部内边距
			
			.filter-tabs {
				display: flex;
				gap: 8rpx; // 减少间距
				
				.filter-tab {
					flex: 1;
					text-align: center;
					padding: 12rpx 8rpx; // 减少左右内边距
					border-radius: 8rpx;
					background-color: #f5f5f5;
					
					&.active {
						background-color: #1BAE76;
						
						.filter-tab-text,
						.filter-count {
							color: #fff;
						}
					}
					
					.filter-tab-text {
						font-size: 22rpx; // 减小字体
						color: #666;
						display: block;
					}
					
					.filter-count {
						font-size: 20rpx; // 减小字体
						color: #999;
						margin-top: 2rpx;
					}
				}
			}
		}
	}
	
	.position-groups {
		.position-group {
			background-color: #fff;
			border-radius: 16rpx;
			margin-bottom: 20rpx;
			overflow: hidden;
			box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.1);
			
			.position-header {
				background: linear-gradient(45deg, #1BAE76, #52c41a);
				padding: 20rpx 30rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				cursor: pointer;
				transition: all 0.3s ease;
				
				&:hover {
					background: linear-gradient(45deg, #16a571, #49b319);
					transform: translateY(-1rpx);
				}
				
				.position-header-left {
					display: flex;
					align-items: center;
					gap: 16rpx;
					
					.position-title {
						font-size: 30rpx;
						font-weight: bold;
						color: #fff;
					}
					
					.position-count {
						font-size: 24rpx;
						color: rgba(255, 255, 255, 0.8);
						background-color: rgba(255, 255, 255, 0.15);
						padding: 4rpx 12rpx;
						border-radius: 16rpx;
						border: 1rpx solid rgba(255, 255, 255, 0.2);
						font-weight: 500;
					}
				}
				
				.position-header-right {
					.collapse-icon {
						font-size: 28rpx;
						color: rgba(255, 255, 255, 0.9);
						transition: transform 0.3s ease;
						transform-origin: center;
						padding: 4rpx 8rpx;
						border-radius: 6rpx;
						background: rgba(255, 255, 255, 0.1);
						
						&:hover {
							background: rgba(255, 255, 255, 0.2);
						}
					}
				}
			}
			
			// 主裁判 - 高级橙色系
			&.position-main-referee {
				border-left: 4rpx solid #ff6b35;
				
				.position-header {
					background: linear-gradient(135deg, #ff8c42 0%, #ff6b35 50%, #d5541e 100%);
					box-shadow: 0 4rpx 20rpx rgba(255, 107, 53, 0.25);
					
					&:hover {
						background: linear-gradient(135deg, #ff9551 0%, #ff7a44 50%, #e25d2d 100%);
						transform: translateY(-1rpx);
					}
				}
			}
			
			// 助理裁判 - 高级蓝色系
			&.position-assistant-referee {
				border-left: 4rpx solid #4472c4;
				
				.position-header {
					background: linear-gradient(135deg, #5b9bd5 0%, #4472c4 50%, #2f5597 100%);
					box-shadow: 0 4rpx 20rpx rgba(68, 114, 196, 0.25);
					
					&:hover {
						background: linear-gradient(135deg, #6ba8dd 0%, #5581cc 50%, #3e609f 100%);
						transform: translateY(-1rpx);
					}
				}
			}
			
			// 第四官员 - 高级绿色系
			&.position-fourth-official {
				border-left: 4rpx solid #5b9930;
				
				.position-header {
					background: linear-gradient(135deg, #70ad47 0%, #5b9930 50%, #507e3a 100%);
					box-shadow: 0 4rpx 20rpx rgba(112, 173, 71, 0.25);
					
					&:hover {
						background: linear-gradient(135deg, #7fb55f 0%, #6ba138 50%, #598842 100%);
						transform: translateY(-1rpx);
					}
				}
			}
			
			// 裁判监督 - 高级紫色系
			&.position-referee-supervisor {
				border-left: 4rpx solid #9b59b6;
				
				.position-header {
					background: linear-gradient(135deg, #8e44ad 0%, #9b59b6 50%, #7d3c98 100%);
					box-shadow: 0 4rpx 20rpx rgba(155, 89, 182, 0.25);
					
					&:hover {
						background: linear-gradient(135deg, #9c55bd 0%, #a868c8 50%, #8542a0 100%);
						transform: translateY(-1rpx);
					}
				}
			}
			
			// 比赛监督 - 高级深蓝色系
			&.position-match-supervisor {
				border-left: 4rpx solid #2c3e50;
				
				.position-header {
					background: linear-gradient(135deg, #34495e 0%, #2c3e50 50%, #1a252f 100%);
					box-shadow: 0 4rpx 20rpx rgba(52, 73, 94, 0.25);
					
					&:hover {
						background: linear-gradient(135deg, #445a76 0%, #3d4c68 50%, #2a3547 100%);
						transform: translateY(-1rpx);
					}
				}
			}
			

			
			.position-content {
				max-height: 9999rpx;
				overflow: hidden;
				transition: max-height 0.3s ease, opacity 0.3s ease;
				opacity: 1;
				
				&.collapsed {
					max-height: 0;
					opacity: 0;
				}
				
				.empty-position {
					padding: 60rpx 30rpx;
					text-align: center;
					
					.empty-text {
						font-size: 26rpx;
						color: #999;
					}
				}
				
				.application-item {
					padding: 30rpx;
					border-bottom: 1rpx solid #f0f0f0;
					
					&:last-child {
						border-bottom: none;
}

					.application-info {
						display: flex;
						justify-content: space-between;
						align-items: flex-start;
						margin-bottom: 20rpx;
						gap: 20rpx;
						
						.user-info-section {
							flex: 1;
							min-width: 0; // 防止内容溢出
							
							.user-header {
								display: flex;
								align-items: center;
								gap: 12rpx;
								margin-bottom: 12rpx;
								flex-wrap: wrap;
								
								.user-name {
									font-size: 32rpx;
									font-weight: bold;
									color: #333;
									flex-shrink: 0;
								}
								
								.user-identity-badge {
									padding: 6rpx 12rpx;
									border-radius: 20rpx;
									font-size: 20rpx;
									flex-shrink: 0;
									
									&.identity-referee {
										background-color: #e6f7ff;
										border: 1rpx solid #91d5ff;
										
										.identity-text {
											color: #1890ff;
										}
									}
									
									&.identity-supervisor {
										background-color: #f6ffed;
										border: 1rpx solid #b7eb8f;
										
										.identity-text {
											color: #52c41a;
										}
									}
									
									&.identity-user {
										background-color: #f5f5f5;
										border: 1rpx solid #d9d9d9;
										
										.identity-text {
											color: #666;
										}
									}
								}
								
								.user-level-inline {
									.level-text {
										display: inline-block;
										padding: 4rpx 8rpx;
										background-color: #fff2e8;
										border: 1rpx solid #ffd591;
										color: #d46b08;
										font-size: 20rpx;
										border-radius: 12rpx;
										font-weight: 500;
									}
								}
							}
							
							.user-details-row {
								margin-bottom: 8rpx;
								
								.user-age-gender {
									font-size: 26rpx;
									color: #666;
								}
							}
							
							.user-association-row {
								margin-bottom: 8rpx;
								
								.user-association {
									font-size: 24rpx;
									color: #999;
									background-color: #f0f8ff;
									padding: 4rpx 8rpx;
									border-radius: 8rpx;
									border: 1rpx solid #e6f4ff;
								}
							}
							
							.user-preferred-positions-row {
								margin-bottom: 8rpx;
								display: flex;
								align-items: center;
								gap: 8rpx;
								
								.preferred-positions-label {
									font-size: 24rpx;
									color: #1BAE76;
									font-weight: 500;
									flex-shrink: 0;
								}
								
								.preferred-positions-value {
									font-size: 24rpx;
									color: #333;
									background-color: #f6ffed;
									padding: 4rpx 8rpx;
									border-radius: 8rpx;
									border: 1rpx solid #b7eb8f;
									font-weight: 500;
								}
							}
						}
						
						.action-buttons {
							display: flex;
							flex-direction: column;
							gap: 8rpx;
							align-items: stretch;
							min-width: 120rpx;
							flex-shrink: 0;

							.action-btn {
								padding: 12rpx 16rpx;
								border-radius: 6rpx;
								font-size: 22rpx;
								border: none;
								text-align: center;
								font-weight: 500;
								
								&.approve-btn {
									background-color: #1BAE76;
									color: #fff;
									
									&:active {
										background-color: #0f8c5c;
									}
								}
								
								&.reject-btn {
									background-color: #ff4d4f;
									color: #fff;
									
									&:active {
										background-color: #d73435;
									}
								}
								
								&.revoke-btn {
									background-color: #ff4d4f;
									color: #fff;
									
									&:active {
										background-color: #d73435;
									}
								}
								
								&:disabled {
									opacity: 0.5;
								}
							}
							
							.status-badge {
								padding: 8rpx 12rpx;
								border-radius: 16rpx;
								font-size: 20rpx;
								color: #fff;
								text-align: center;
								font-weight: 500;
								
								&.status-selected {
									background-color: #fa8c16;
								}
								
								&.status-confirmed {
									background-color: #52c41a;
								}
								
								&.status-confirmed {
									background-color: #52c41a;
								}
								
								&.status-rejected {
									background-color: #ff4d4f;
								}
								
								&.status-pending {
									background-color: #fa8c16;
								}
							}
						}
					}
					
										.application-details {
						background-color: #f8f9fa;
						padding: 24rpx;
						border-radius: 12rpx;
						margin-bottom: 16rpx;
						border: 1rpx solid #e8e8e8;

						.detail-row {
							display: flex;
							margin-bottom: 16rpx;
							padding: 12rpx 0;
							border-bottom: 1rpx solid #f0f0f0;
							
							&:last-child {
								margin-bottom: 0;
								border-bottom: none;
							}

							&.conflict {
								background-color: #fff2f0;
								padding: 12rpx 16rpx;
								border-radius: 8rpx;
								border: 1rpx solid #ffccc7;
								border-bottom: 1rpx solid #ffccc7;
								
								.detail-label {
									color: #cf1322;
									font-weight: 500;
								}
								
								.detail-value {
									color: #ff4d4f;
									font-weight: 500;
								}
							}
							
							.detail-label {
								font-size: 24rpx;
								color: #666;
								width: 180rpx;
								flex-shrink: 0;
								font-weight: 500;
							}

							.detail-value {
								font-size: 24rpx;
								color: #333;
								flex: 1;
								word-break: break-all;
							}
						}
					}

					.toggle-details {
						display: flex;
						justify-content: center;
						align-items: center;
						gap: 8rpx;
						padding: 16rpx;
						background-color: #f5f5f5;
						border-radius: 8rpx;
						
						.toggle-text {
							font-size: 24rpx;
 color: #666;
						}
						
						.toggle-icon {
							font-size: 20rpx;
							color: #999;
						}
					}
				}
			}
		}
	}
}

// 拒绝弹窗
.reject-popup {
	width: 80vw;
	max-width: 600rpx;
	background-color: #fff;
	border-radius: 16rpx;
	overflow: hidden;
}

.popup-header {
	padding: 30rpx;
	background: linear-gradient(45deg, #1BAE76, #52c41a);

.popup-title {
	font-size: 32rpx;
	font-weight: bold;
		color: #fff;
		text-align: center;
	}
}

.popup-content {
	padding: 30rpx;

.popup-label {
	font-size: 28rpx;
	color: #333;
		margin-bottom: 16rpx;
}

.reject-reason-input {
	width: 100%;
	min-height: 200rpx;
		padding: 16rpx;
	border: 2rpx solid #e0e0e0;
	border-radius: 8rpx;
		font-size: 26rpx;
		color: #333;
		background-color: #fafafa;
	}
}

.popup-actions {
	display: flex;
	border-top: 1rpx solid #e0e0e0;

.popup-btn {
	flex: 1;
	 height: 88rpx;
	 font-size: 28rpx;
 border: none;
	
	&.cancel-btn {
			background-color: #f5f5f5;
		color: #666;
	}
	
	&.confirm-btn {
			background-color: #ff4d4f;
			color: #fff;
		}
	}
}



// 轮次选派汇总表弹窗
.round-selection-popup {
	width: 95vw;
	max-width: 1200rpx;
	max-height: 85vh;
	background-color: #fff;
	border-radius: 20rpx;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.3);
	border: 2rpx solid rgba(255, 255, 255, 0.8);
	animation: popupSlideIn 0.3s ease-out;
	
	.popup-header {
		padding: 40rpx 30rpx;
		background: linear-gradient(135deg, #1BAE76 0%, #52c41a 100%);
		position: relative;
		
		&::after {
			content: '';
			position: absolute;
			bottom: 0;
			left: 0;
			right: 0;
			height: 2rpx;
			background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
		}

		.popup-title {
			font-size: 36rpx;
			font-weight: bold;
			color: #fff;
			text-align: center;
			text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2);
			letter-spacing: 1rpx;
		}
	}

	.popup-content {
		padding: 30rpx;
		padding-bottom: 60rpx; // 底部预留更多距离
		flex: 1;
		overflow: auto;

		.match-info-section {
			margin-bottom: 30rpx;
			padding: 24rpx;
			background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
			border-radius: 12rpx;
			border: 1rpx solid #e0e0e0;

			.info-row {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-bottom: 16rpx;
				padding: 8rpx 0;
				
				&:last-child {
					margin-bottom: 0;
				}

				.info-label {
					font-size: 28rpx;
					color: #666;
					font-weight: 500;
				}

				.info-value {
					font-size: 26rpx;
					color: #333;
					font-weight: 500;
					text-align: right;
				}
			}
		}

		.match-schedule-timeline {
			max-height: 450rpx;
			overflow-y: auto;
			margin-bottom: 40rpx;
			
			.timeline-container {
				position: relative;
				
				.timeline-day {
					margin-bottom: 40rpx;
					position: relative;
					
					&:last-child {
						margin-bottom: 0;
					}
					
					// 时间轴线条连接到下一天
					&:not(:last-child)::after {
						content: '';
						position: absolute;
						left: 50rpx;
						top: 100%;
						width: 2rpx;
						height: 40rpx;
						background: linear-gradient(to bottom, #1BAE76, transparent);
					}
					
					.date-header {
						display: flex;
						align-items: center;
						margin-bottom: 20rpx;
						position: relative;
						
						// 时间轴圆点
						&::before {
							content: '';
							position: absolute;
							left: 44rpx;
							top: 50%;
							transform: translateY(-50%);
							width: 12rpx;
							height: 12rpx;
							border-radius: 50%;
							background-color: #1BAE76;
							border: 3rpx solid #fff;
							box-shadow: 0 0 0 2rpx #1BAE76;
						}
						
						.date-text {
							font-size: 28rpx;
							font-weight: bold;
							margin-left: 80rpx;
							padding: 8rpx 16rpx;
							background: linear-gradient(45deg, #1BAE76, #52c41a);
							color: #fff;
							border-radius: 20rpx;
							box-shadow: 0 2rpx 8rpx rgba(27, 174, 118, 0.3);
						}
					}
					
					.time-slot-card {
						background-color: #fff;
						border-radius: 16rpx;
						padding: 20rpx;
						margin-left: 80rpx;
						margin-bottom: 16rpx;
						box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08);
						border: 1rpx solid #e8e8e8;
						position: relative;
						
						&:last-child {
							margin-bottom: 0;
						}
						
						// 卡片连接线
						&::before {
							content: '';
							position: absolute;
							left: -32rpx;
							top: 20rpx;
							width: 32rpx;
							height: 2rpx;
							background-color: #1BAE76;
						}
						
						.match-header {
							display: flex;
							align-items: center;
							margin-bottom: 12rpx;
							gap: 16rpx;
							flex-wrap: wrap;
							
							.teams {
								font-size: 30rpx;
								font-weight: 700;
								color: #1d1d1f;
								letter-spacing: 1rpx;
								text-shadow: 0 1rpx 2rpx rgba(0, 0, 0, 0.1);
							}
							
							.venue-info {
								font-size: 26rpx;
								color: #007aff;
								font-weight: 600;
								letter-spacing: 0.5rpx;
								text-shadow: 0 1rpx 2rpx rgba(0, 0, 0, 0.1);
							}
						}
						
						.time-info {
							margin-bottom: 16rpx;
							
							.time-range {
								font-size: 26rpx;
								font-weight: bold;
								color: #1BAE76;
								padding: 4rpx 10rpx;
								background-color: #f0f8ff;
								border-radius: 10rpx;
								border: 1rpx solid #d9d9d9;
							}
						}
						
						.referee-assignments {
							display: flex;
							flex-wrap: wrap;
							gap: 16rpx;
							
							.referee-item {
								background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
								padding: 16rpx 20rpx;
								border-radius: 16rpx;
								border: 2rpx solid #e0e0e0;
								display: flex;
								align-items: center;
								gap: 12rpx;
								box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
								transition: all 0.3s ease;
								
								&:hover {
									transform: translateY(-2rpx);
									box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.12);
								}
								
								.referee-name {
									font-size: 30rpx;
									color: #1d1d1f;
									font-weight: 600;
									letter-spacing: 0.5rpx;
								}
								
								.referee-position {
									font-size: 26rpx;
									color: #007aff;
									font-weight: 500;
									white-space: nowrap;
								}
								
								.phone-container {
									display: flex;
									align-items: center;
									margin-left: 12rpx;
									padding: 8rpx 12rpx;
									background: linear-gradient(135deg, #e6f7ff 0%, #f0f8ff 100%);
									border-radius: 12rpx;
									border: 1rpx solid #91d5ff;
									box-shadow: 0 2rpx 6rpx rgba(0, 122, 255, 0.1);
								}
								
								.referee-phone {
									font-size: 28rpx;
									color: #1BAE76;
									font-family: 'Courier New', monospace;
									font-weight: 700;
									letter-spacing: 1rpx;
									text-shadow: 0 1rpx 2rpx rgba(0, 0, 0, 0.1);
								}
							}
							
							.waiting-assignment {
								width: 100%;
								text-align: center;
								padding: 24rpx;
								background: linear-gradient(135deg, #fff7e6 0%, #fffbe6 100%);
								border-radius: 16rpx;
								border: 2rpx solid #ffd591;
								box-shadow: 0 4rpx 12rpx rgba(255, 213, 145, 0.3);
								
								.waiting-text {
									font-size: 30rpx;
									color: #d46b08;
									font-weight: 600;
									font-style: italic;
									text-shadow: 0 1rpx 2rpx rgba(0, 0, 0, 0.1);
								}
							}
						}
					}
				}
			}
		}
	}

	.popup-actions {
		display: flex;
		padding: 30rpx;
		gap: 20rpx;
		background-color: #f8f9fa;
		border-top: 1rpx solid #e8e8e8;

		.popup-btn {
			flex: 1;
			height: 88rpx;
			font-size: 28rpx;
			font-weight: 500;
			border: none;
			border-radius: 44rpx;
			transition: all 0.3s ease;
			box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
			
			&.cancel-btn {
				background-color: #fff;
				color: #666;
				border: 2rpx solid #e0e0e0;
				
				&:active {
					background-color: #f5f5f5;
					transform: scale(0.98);
				}
			}
			
			&.confirm-btn {
				background: linear-gradient(45deg, #1BAE76, #52c41a);
				color: #fff;
				box-shadow: 0 4rpx 12rpx rgba(27, 174, 118, 0.3);
				
				&:active {
					background: linear-gradient(45deg, #0f8c5c, #389e0d);
					transform: scale(0.98);
				}
			}
		}
	}
}

// 弹窗动画
@keyframes popupSlideIn {
	0% {
		opacity: 0;
		transform: scale(0.95);
	}
	100% {
		opacity: 1;
		transform: scale(1);
	}
}

// 选派表入口
.selection-table-entry {
	margin-top: 20rpx;
	padding-top: 20rpx;
	border-top: 1rpx solid #f2f2f7;
	display: flex;
	flex-direction: row;
	gap: 16rpx;
	
	.selection-table-btn {
		flex: 1;
		padding: 16rpx 12rpx;
		border-radius: 16rpx;
		border: none;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;
		gap: 8rpx;
		transition: all 0.2s ease;
		
		&:active {
			transform: scale(0.95);
		}
		
		&:disabled {
			opacity: 0.5;
			transform: none;
		}
		
		&.generate-btn {
			background: linear-gradient(135deg, #1BAE76 0%, #52c41a 100%);
			box-shadow: 0 4rpx 16rpx rgba(27, 174, 118, 0.25);
			
			&:active {
				box-shadow: 0 2rpx 8rpx rgba(27, 174, 118, 0.3);
			}
		}
		
		&.view-btn {
			background: linear-gradient(135deg, #007aff 0%, #5ac8fa 100%);
			box-shadow: 0 4rpx 16rpx rgba(0, 122, 255, 0.25);
			
			&:active {
				box-shadow: 0 2rpx 8rpx rgba(0, 122, 255, 0.3);
			}
		}
		
		.btn-text {
			font-size: 30rpx;
			font-weight: 500;
			color: #fff;
			letter-spacing: -0.3rpx;
		}
	}
}

// 系列赛列表
.series-list {
	.empty-container {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		height: 400rpx;
		background-color: #fff;
		border-radius: 16rpx;
		margin: 0 8rpx;
		box-shadow: 0 2rpx 20rpx rgba(0, 0, 0, 0.06);

		.empty-text {
			font-size: 32rpx;
			color: #999;
			margin-top: 20rpx;
		}
	}
}

.series-card {
	background-color: #fff;
	border-radius: 16rpx;
	margin: 0 8rpx 16rpx 8rpx;
	box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08);
	border: 1rpx solid rgba(0, 0, 0, 0.04);
	overflow: hidden;
	transition: all 0.3s ease;
	
	&:active {
		transform: scale(0.98);
		box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.12);
	}
	
	// 卡片头部
	.card-header {
		padding: 20rpx 20rpx 16rpx 20rpx;
		display: flex;
		justify-content: space-between;
		align-items: flex-start;
		position: relative;
		
		.title-section {
			flex: 1;
			min-width: 0;
			
			.title-row {
				display: flex;
				align-items: center;
				gap: 12rpx;
				margin-bottom: 16rpx;
				
				.series-title {
					font-size: 36rpx;
					font-weight: 600;
					color: #1d1d1f;
					line-height: 1.25;
					letter-spacing: -0.5rpx;
					flex: 1;
				}
				
				// 状态标记
				.status-badge {
					padding: 4rpx 12rpx;
					border-radius: 12rpx;
					font-size: 20rpx;
					font-weight: 500;
					flex-shrink: 0;
					margin-left: 8rpx;
					
					&.new-applications {
						background-color: #ff4d4f;
						color: #fff;
						animation: pulse 2s infinite;
					}
					
					&.completed {
						background-color: #8e8e93;
						color: #fff;
					}
					
					.badge-text {
						font-size: 20rpx;
						font-weight: 500;
						color: inherit;
					}
				}
			}
			
			.meta-row {
				display: flex;
				flex-direction: column;
				gap: 8rpx;
				
				.meta-item {
					display: flex;
					align-items: center;
					gap: 8rpx;
					
					.meta-text {
						font-size: 28rpx;
						color: #8e8e93;
						font-weight: 400;
					}
				}
			}
		}
		
		.status-indicator {
			position: relative;
			margin-left: 16rpx;
			
			.status-dot {
				width: 16rpx;
				height: 16rpx;
				border-radius: 50%;
				background-color: #d1d1d6;
			}
			
			&.status-pending .status-dot {
				background-color: #ff9500;
				box-shadow: 0 0 0 2rpx rgba(255, 149, 0, 0.2);
			}
			
			&.status-active .status-dot {
				background-color: #30d158;
				box-shadow: 0 0 0 2rpx rgba(48, 209, 88, 0.2);
			}
			
			&.status-completed .status-dot {
				background-color: #8e8e93;
				box-shadow: 0 0 0 2rpx rgba(142, 142, 147, 0.2);
			}
			
			&.status-new-applications .status-dot {
				background-color: #ff4d4f;
				box-shadow: 0 0 0 2rpx rgba(255, 77, 79, 0.2);
			}
		}
	}
	
	// 根据状态为卡片添加左边框颜色
	&.status-pending {
		border-left: 4rpx solid #ff9500;
	}
	
	&.status-active {
		border-left: 4rpx solid #30d158;
	}
	
	&.status-completed {
		border-left: 4rpx solid #8e8e93;
		filter: grayscale(0.3);
		opacity: 0.85;
		
		.series-title {
			color: #8e8e93;
		}
		
		.meta-text {
			color: #aeaeb2;
		}
		
		.stat-number {
			color: #8e8e93;
		}
	}
	
	&.status-new-applications {
		border-left: 4rpx solid #ff4d4f;
		box-shadow: 0 4rpx 20rpx rgba(255, 77, 79, 0.15);
	}
	
	&.status-normal {
		border-left: 4rpx solid #d1d1d6;
	}
	
	// 统计数据区域
	.stats-section {
		display: flex;
		align-items: center;
		padding: 0 20rpx 16rpx 20rpx;
		
		.stat-item {
			flex: 1;
			text-align: center;
			
			&.highlight .stat-number {
				color: #ff9500;
			}
			
			.stat-content {
				.stat-number {
					display: block;
					font-size: 32rpx;
					font-weight: 600;
					color: #1d1d1f;
					margin-bottom: 4rpx;
					letter-spacing: -0.5rpx;
				}
				
				.stat-label {
					font-size: 24rpx;
					color: #8e8e93;
					font-weight: 400;
				}
			}
		}
		
		.stat-divider {
			width: 1rpx;
			height: 32rpx;
			background-color: #e5e5ea;
			margin: 0 8rpx;
		}
	}
	
	// 卡片底部
	.card-footer {
		padding: 0 20rpx 16rpx 20rpx;
		
		.action-btn {
			width: 100%;
			height: 72rpx;
			border-radius: 16rpx;
			font-size: 30rpx;
			font-weight: 500;
			border: none;
			background: linear-gradient(135deg, #1BAE76 0%, #52c41a 100%);
			color: #fff;
			display: flex;
			align-items: center;
			justify-content: center;
			gap: 8rpx;
			box-shadow: 0 4rpx 16rpx rgba(27, 174, 118, 0.25);
			transition: all 0.2s ease;
			
			&.urgent {
				background: linear-gradient(135deg, #ff9500 0%, #ff6b35 100%);
				box-shadow: 0 4rpx 16rpx rgba(255, 149, 0, 0.3);
			}
			
			&:active {
				transform: scale(0.95);
				box-shadow: 0 2rpx 8rpx rgba(27, 174, 118, 0.3);
			}
			
			.btn-text {
				font-size: 30rpx;
				font-weight: 500;
				color: #fff;
				letter-spacing: -0.3rpx;
			}
		}
	}
}

// 动画定义
@keyframes pulse {
	0% {
		transform: scale(1);
		box-shadow: 0 0 0 0 rgba(255, 77, 79, 0.7);
	}
	
	70% {
		transform: scale(1.05);
		box-shadow: 0 0 0 10rpx rgba(255, 77, 79, 0);
	}
	
	100% {
		transform: scale(1);
		box-shadow: 0 0 0 0 rgba(255, 77, 79, 0);
	}
}


</style> 